home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
COMPILER
/
LCCBIN
/
!lcc
/
!Help
< prev
next >
Wrap
Text File
|
1998-06-07
|
5KB
|
117 lines
LCC 4.0 for RISC OS
———————————————————
ported by Reuben Thomas (rrt@sc3d.org)
Lcc is an ANSI C compiler. It is small and fast, though the code it produces
is currently of poor quality. However, because of its speed (about twice as
fast as GNU C with no optimisation) it is useful for development work, when
you spend far more time compiling than running your programs, and because of
its size it should run on computers that cannot accomodate GNU C (I think it
should be possible to use it without virtual memory on machines with 2Mb
RAM; possibly even 1Mb).
Owing to the paucity of the documentation, this is not really a package for
novices, but do feel free to ask me questions about installation and use
(preferably on the comp.sys.acorn.programmer newsgroup, so that others can
benefit from the answers).
Stu Smith (s.d.smith@exeter.ac.uk) is working on an improved code generator.
For details see http://www.geocities.com/SiliconValley/Lab/4330/.
Conditions
——————————
See the files in Docs.Licenses for conditions of use.
Usage
—————
To install lcc, copy the !lcc and !clib applications out of the distribution
archive. They can even be installed on a floppy (a squeeze in 800Kb, more
plausible in 1.6Mb. If you are running RISC OS 3.6 or lower, copy the module
CallASWI into your !System.Modules directory.
See the documentation in Docs for how to use lcc and bprint (bprint is used
for profiling).
Lcc comes with a modified version of Nick Burrett's CLib, which links with
the Shared C Library. You can also use UnixLib (from
http://www.callan.demon.co.uk/unixlib/); to do so you must pass the -Bunix
switch to lcc (this switch will probably change in future releases).
If you want to link with CLib but still have automatic Unix filename
translation, define __UNAME by passing -D__UNAME to lcc. See the file
!FileTrans in !clib for more information.
If you are interested in the innards, lcc version 3.x is described in detail
in the book `A Retargetable C Compiler: Design and Implementation'
(Addison-Wesley, 1995, ISBN 0-8053-1670-1). The source distribution is
available from the main ftp site (<address here>).
Problems and limitations
————————————————————————
Lcc has been tested fairly thoroughly: if used to compile itself, this
version then compiles a version identical to itself; but I expect bugs
remain. Please report them to me, not to lcc's authors. A small (less than 10
lines) program demonstrating the bug would be much appreciated.
Lcc is incompatible with Acorn C in two areas: first, it does not widen
float arguments to double before passing them to a function in which they
are declared float, and secondly it does not return some one-word structures
in the same way. In practice this isn't a problem, as neither difference
affects the Shared C Library, but it is something to be careful of when
linking to other libraries or code.
The only debugging information provided by the -g flag is function names in
stack backtraces.
If you get error messages about "overflow in floating constant 'x'", it might
be because of a bug in gcc which compiles floating-point constants
incorrectly. I have hand-patched this in the assembler source, but if I've
recompiled lcc without doing this by mistake then the bug will have crept
back in. The tell-tale sign is to try compiling a program that just prints
FLT_MAX. This should not cause an overflow message.
I've not tested bprint and the profiling flags. I'd appreciate any feedback
on how well they work, if at all. I suspect that all I'm likely to do at the
moment is to add a warning notice rather than fixing them.
The file redirection code has some limitations; see !clib.!Help. In
particular, if a file called junk.o is to be created (e.g. by compiling
junk.c), a directory called "o" must already exist in the destination
directory, as it will not be created automatically.
Source files must have names of the form "foo.c" or "c.foo", and preferably
be passed to LCC as "foo.c".
If you have GCC installed you should delete !lcc.bin.cpp as GCC's cpp works
with lcc but not vice versa.
Acknowledgments
———————————————
The authors of lcc, David Hanson and Chris Fraser, were most helpful while I
was porting it, explaining difficulties and putting up with questions that
were actually answered in their book. I recommend the book (see above) to
anyone interested in how C compilers really work.
Nick Burrett, the maintainer of RISC OS GCC, kindly allowed me to use gcc's
interface to drlink, ld, and his clib stubs library, as well as providing
helpful advice on APCS.
Dave Daniels, author of Drlink, kindly allowed me to distribute it with lcc.
Darren Salt and Nick Burret, the maintainers of as, kindly allowed me to
distribute it with lcc.
Dominic Symes, Tim Tyler and the other authors of Zap continue to provide
the most comfortable programming environment I have yet used on the Acorn or
any other machine.